<%@ page import="com.octo.captcha.service.CaptchaServiceException" %>
<%@ page import="services.CaptchaServiceSingleton" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
           Boolean isResponseCorrect = Boolean.FALSE;
           //remenber that we need an id to validate!
           String captchaId = request.getSession().getId();
           //retrieve the response
           String answer = request.getParameter("j_captcha_response");
           // Call the Service method
            try {
                isResponseCorrect = CaptchaServiceSingleton.getInstance().validateResponseForID(captchaId, answer);
                if (isResponseCorrect)
                {
                }
            } catch (CaptchaServiceException e) {
                 System.out.println(e.toString());
            }
%>
<html>
  <head><title>Controller</title></head>
  <body>
Session id: <%= request.getSession().getId() %> <br>
Challenge: <%= CaptchaServiceSingleton.getInstance().getChallengeForID(captchaId)%> <br>
Question: <%= CaptchaServiceSingleton.getInstance().getQuestionForID(captchaId)%> <br>
Answer: <%= answer %> <br>
Your answer is: <%= isResponseCorrect %>
  </body>
</html>